import { http } from '@/utils/http/axios';
interface Data {
  days: string;
  task: string;
  limit: number;
  offset: number;
}
interface Memo {
  days: string;
  memo: string;
  limit: number;
  offset: number;
}

export interface MemoDate {
  title: string;
  content: string;
  id: number;
}
// * 获取任务
export function getTasks(data: Data) {
  return http.request(
    {
      url: '/tasks',
      method: 'GET',
      params: data,
    },
    {
      isTransformResponse: false,
    }
  );
}
// * 获取便签
export function stagingMemo(data: Memo) {
  return http.request(
    {
      url: '/memo',
      method: 'GET',
      params: data,
    },
    {
      isTransformResponse: false,
    }
  );
}
// * 完成任务
export function finishTask(id: number) {
  return http.request(
    {
      url: `/task/finish/${id}`,
      method: 'PUT',
    },
    {
      isTransformResponse: false,
    }
  );
}
// * 完成便签
export function fulfilMemo(id: number) {
  return http.request(
    {
      url: `/memo/finish/${id}`,
      method: 'PUT',
    },
    {
      isTransformResponse: false,
    }
  );
}
// * 删除便签
export function deleteMemo(id: number) {
  return http.request(
    {
      url: `/memo/${id}`,
      method: 'DELETE',
    },
    { isTransformResponse: false }
  );
}
// * 修改便签
export function updateMemo(data: MemoDate) {
  return http.request(
    {
      url: `/memo/${data.id}`,
      method: 'PUT',
      data: data,
    },
    { isTransformResponse: false }
  );
}
// * 新增便签
export function addMemo(data: { title: string; content: string }) {
  return http.request(
    {
      url: `/memo`,
      method: 'POST',
      data: data,
    },
    { isTransformResponse: false }
  );
}
